(()=>{var e={678:function(e,t,n){var r,o;r=function(){"use strict";function e(e){for(var t=[],n=0,r=e.length;n":function(e,t){return e>t},">=":function(e,t){return e>=t},"<":function(e,t,n){return void 0===n?e=e?[]:r}};return t.is_logic=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)&&1===Object.keys(e).length},t.truthy=function(e){return!(Array.isArray(e)&&0===e.length||!e)},t.get_operator=function(e){return Object.keys(e)[0]},t.get_values=function(e){return e[t.get_operator(e)]},t.apply=function(e,r){if(Array.isArray(e))return e.map((function(e){return t.apply(e,r)}));if(!t.is_logic(e))return e;var o,a,i,s,u,c=t.get_operator(e),l=e[c];if(Array.isArray(l)||(l=[l]),"if"===c||"?:"==c){for(o=0;o0){var d=String(c).split("."),p=n;for(o=0;o{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(678),t=n.n(e);const r=(e,t)=>Array.prototype.slice.call(e,t);let o=null;"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?o=self:void 0!==n.g?o=n.g:window&&(o=window);const a=o,i=o.document,s=["load","loadend","loadstart"],u=["progress","abort","error","timeout"],c=e=>["returnValue","totalSize","position"].includes(e),l=function(e,t){for(let n in e){if(c(n))continue;const r=e[n];try{t[n]=r}catch(e){}}return t},d=function(e,t,n){const r=e=>function(r){const o={};for(let e in r){if(c(e))continue;const a=r[e];o[e]=a===t?n:a}return n.dispatchEvent(e,o)};for(let o of Array.from(e))n._has(o)&&(t[`on${o}`]=r(o))},p=function(e){let t={};const n=e=>t[e]||[],o={addEventListener:function(e,r,o){t[e]=n(e),t[e].indexOf(r)>=0||(o=void 0===o?t[e].length:o,t[e].splice(o,0,r))},removeEventListener:function(e,r){if(void 0===e)return void(t={});void 0===r&&(t[e]=[]);const o=n(e).indexOf(r);-1!==o&&n(e).splice(o,1)}};return o.dispatchEvent=function(){const t=r(arguments),a=t.shift();e||(t[0]=l(t[0],function(e){if(i&&null!=i.createEventObject){const t=i.createEventObject();return t.type=e,t}try{return new Event(e)}catch(t){return{type:e}}}(a)),Object.defineProperty(t[0],"target",{writable:!1,value:this}));const s=o[`on${a}`];s&&s.apply(o,t);const u=n(a).concat(n("*"));for(let e=0;e!(!t[e]&&!o[`on${e}`]),e&&(o.listeners=e=>r(n(e)),o.on=o.addEventListener,o.off=o.removeEventListener,o.fire=o.dispatchEvent,o.once=function(e,t){var n=function(){return o.off(e,n),t.apply(null,arguments)};return o.on(e,n)},o.destroy=()=>t={}),o};var f=function(e,t){switch(typeof e){case"object":return n=e,Object.entries(n).map((([e,t])=>`${e.toLowerCase()}: ${t}`)).join("\r\n");case"string":return function(e,t){const n=e.split("\r\n");null==t&&(t={});for(let e of n)if(/([^:]+):\s*(.+)/.test(e)){const e=null!=RegExp.$1?RegExp.$1.toLowerCase():void 0,n=RegExp.$2;null==t[e]&&(t[e]=n)}return t}(e,t)}var n;return[]};const y=p(!0),h=e=>void 0===e?null:e,w=a.XMLHttpRequest,g=function(){const e=new w,t={};let n,r,o,a=null;var i=0;const c=function(){if(o.status=a||e.status,-1!==a&&(o.statusText=e.statusText),-1===a);else{const t=f(e.getAllResponseHeaders());for(let e in t){const n=t[e];if(!o.headers[e]){const t=e.toLowerCase();o.headers[t]=n}}}},g=function(){E.status=o.status,E.statusText=o.statusText},m=function(){n||E.dispatchEvent("load",{}),E.dispatchEvent("loadend",{}),n&&(E.readyState=0)},b=function(e){for(;e>i&&i<4;)E.readyState=++i,1===i&&E.dispatchEvent("loadstart",{}),2===i&&g(),4===i&&(g(),"text"in o&&(E.responseText=o.text),"xml"in o&&(E.responseXML=o.xml),"data"in o&&(E.response=o.data),"finalUrl"in o&&(E.responseURL=o.finalUrl)),E.dispatchEvent("readystatechange",{}),4===i&&(!1===t.async?m():setTimeout(m,0))},v=function(e){if(4!==e)return void b(e);const n=y.listeners("after");var r=function(){if(n.length>0){const e=n.shift();2===e.length?(e(t,o),r()):3===e.length&&t.async?e(t,o,r):r()}else b(4)};r()};var E=p();t.xhr=E,e.onreadystatechange=function(t){try{2===e.readyState&&c()}catch(e){}4===e.readyState&&(r=!1,c(),function(){if(e.responseType&&"text"!==e.responseType)"document"===e.responseType?(o.xml=e.responseXML,o.data=e.responseXML):o.data=e.response;else{o.text=e.responseText,o.data=e.responseText;try{o.xml=e.responseXML}catch(e){}}"responseURL"in e&&(o.finalUrl=e.responseURL)}()),v(e.readyState)};const H=function(){n=!0};E.addEventListener("error",H),E.addEventListener("timeout",H),E.addEventListener("abort",H),E.addEventListener("progress",(function(t){i<3?v(3):e.readyState<=3&&E.dispatchEvent("readystatechange",{})})),"withCredentials"in e&&(E.withCredentials=!1),E.status=0;for(let e of Array.from(u.concat(s)))E[`on${e}`]=null;if(E.open=function(e,a,s,u,c){i=0,n=!1,r=!1,t.headers={},t.headerNames={},t.status=0,t.method=e,t.url=a,t.async=!1!==s,t.user=u,t.pass=c,o={},o.headers={},v(1)},E.send=function(n){let a,i;for(a of["type","timeout","withCredentials"])i="type"===a?"responseType":a,i in E&&(t[a]=E[i]);t.body=n;const c=y.listeners("before");var p=function(){if(!c.length)return function(){for(a of(d(u,e,E),E.upload&&d(u.concat(s),e.upload,E.upload),r=!0,e.open(t.method,t.url,t.async,t.user,t.pass),["type","timeout","withCredentials"]))i="type"===a?"responseType":a,a in t&&(e[i]=t[a]);for(let n in t.headers){const r=t.headers[n];n&&e.setRequestHeader(n,r)}e.send(t.body)}();const n=function(e){if("object"==typeof e&&("number"==typeof e.status||"number"==typeof o.status))return l(e,o),"data"in e||(e.data=e.response||e.text),void v(4);p()};n.head=function(e){l(e,o),v(2)},n.progress=function(e){l(e,o),v(3)};const f=c.shift();1===f.length?n(f(t)):2===f.length&&t.async?f(t,n):n()};p()},E.abort=function(){a=-1,r?e.abort():E.dispatchEvent("abort",{})},E.setRequestHeader=function(e,n){const r=null!=e?e.toLowerCase():void 0,o=t.headerNames[r]=t.headerNames[r]||e;t.headers[o]&&(n=t.headers[o]+", "+n),t.headers[o]=n},E.getResponseHeader=e=>h(o.headers[e?e.toLowerCase():void 0]),E.getAllResponseHeaders=()=>h(f(o.headers)),e.overrideMimeType&&(E.overrideMimeType=function(){e.overrideMimeType.apply(e,arguments)}),e.upload){let e=p();E.upload=e,t.upload=e}return E.UNSENT=0,E.OPENED=1,E.HEADERS_RECEIVED=2,E.LOADING=3,E.DONE=4,E.response="",E.responseText="",E.responseXML=null,E.readyState=0,E.statusText="",E};g.UNSENT=0,g.OPENED=1,g.HEADERS_RECEIVED=2,g.LOADING=3,g.DONE=4;var m={patch(){w&&(a.XMLHttpRequest=g)},unpatch(){w&&(a.XMLHttpRequest=w)},Native:w,Xhook:g};function b(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}u((r=r.apply(e,t||[])).next())}))}const v=a.fetch;function E(e){return e instanceof Headers?H([...e.entries()]):Array.isArray(e)?H(e):e}function H(e){return e.reduce(((e,[t,n])=>(e[t]=n,e)),{})}const $=function(e,t={headers:{}}){let n=Object.assign(Object.assign({},t),{isFetch:!0});if(e instanceof Request){const r=function(e){let t={};return["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","url"].forEach((n=>t[n]=e[n])),t}(e),o=Object.assign(Object.assign({},E(r.headers)),E(n.headers));n=Object.assign(Object.assign(Object.assign({},r),t),{headers:o,acceptedRequest:!0})}else n.url=e;const r=y.listeners("before"),o=y.listeners("after");return new Promise((function(t,a){let i=t;const s=function(e){if(!o.length)return i(e);const t=o.shift();return 2===t.length?(t(n,e),s(e)):3===t.length?t(n,e,s):s(e)},u=function(e){if(void 0!==e){const n=new Response(e.body||e.text,e);return t(n),void s(n)}c()},c=function(){if(!r.length)return void l();const e=r.shift();return 1===e.length?u(e(n)):2===e.length?e(n,u):void 0},l=()=>b(this,void 0,void 0,(function*(){const{url:t,isFetch:r,acceptedRequest:o}=n,u=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);os(e))).catch((function(e){return i=a,s(e),a(e)}))}));c()}))};var P={patch(){v&&(a.fetch=$)},unpatch(){v&&(a.fetch=v)},Native:v,Xhook:$};const A=y;A.EventEmitter=p,A.before=function(e,t){if(e.length<1||e.length>2)throw"invalid hook";return A.on("before",e,t)},A.after=function(e,t){if(e.length<2||e.length>3)throw"invalid hook";return A.on("after",e,t)},A.enable=function(){m.patch(),P.patch()},A.disable=function(){m.unpatch(),P.unpatch()},A.XMLHttpRequest=m.Native,A.fetch=P.Native,A.headers=f,A.enable();const O=e=>{let t=0;const n=setInterval((()=>{t++;const r=document.querySelector("shopify-paypal-button");if((r||t>100)&&(clearInterval(n),r)){const t=r.parentElement.parentElement;e?(t.style.minHeight="0",t.style.height="0"):(t.style.removeProperty("min-height"),t.style.removeProperty("height"))}}),100)},F=(e,t,n,r)=>{switch(e){case"paypal":const e=document.getElementById("paypal-customization");e&&(e.innerHTML=`\n ${r&&(window.HidePayFE.drawerId?`#${window.HidePayFE.drawerId} `:"")+"shopify-paypal-button"},\n ${"product"==t&&"shopify-paypal-button"},\n ${"cart"==t&&"shopify-paypal-button"} {\n display: ${n?"inline-block!important":"none!important"};\n ${n?"width: 100%;":""}\n ${n?"height: 100%;":""}\n }\n `);break;case"google":const o=document.getElementById("google-customization");o&&(o.innerHTML=`\n ${r&&(window.HidePayFE.drawerId?`#${window.HidePayFE.drawerId} `:"")+"shopify-google-pay-button"},\n ${"product"==t&&"shopify-google-pay-button"},\n ${"cart"==t&&"shopify-google-pay-button"} {\n display: ${n?"inline-block!important":"none!important"};\n ${n?"width: 100%;":""}\n ${n?"height: 100%;":""}\n }\n `);break;case"apple":const a=document.getElementById("apple-customization");a&&(a.innerHTML=`\n ${r&&(window.HidePayFE.drawerId?`#${window.HidePayFE.drawerId} `:"")+"shopify-apple-pay-button"},\n ${"product"==t&&"shopify-apple-pay-button"},\n ${"cart"==t&&"shopify-apple-pay-button"} {\n display: ${n?"inline-block!important":"none!important"};\n ${n?"width: 100%;":""}\n ${n?"height: 100%;":""}\n }\n `);break;case"shoppay":const i=document.getElementById("shoppay-customization");i&&(i.innerHTML=`\n ${r&&(window.HidePayFE.drawerId?`#${window.HidePayFE.drawerId} `:"")+"shop-pay-wallet-button"},\n ${"product"==t&&"shop-pay-wallet-button"},\n ${"cart"==t&&"shop-pay-wallet-button"} {\n display: ${n?"inline-block!important":"none!important"};\n ${n?"width: 100%;":""}\n ${n?"height: 100%;":""}\n }\n `);break;case"amazon":const s=document.getElementById("amazon-customization");s&&(s.innerHTML=`\n ${r&&(window.HidePayFE.drawerId?`#${window.HidePayFE.drawerId} `:"")+"shopify-amazon-pay-button"},\n ${"product"==t&&"shopify-amazon-pay-button"},\n ${"cart"==t&&"shopify-amazon-pay-button"} {\n display: ${n?"inline-block!important":"none!important"};\n ${n?"width: 100%;":""}\n ${n?"height: 100%;":""}\n }\n `);break;default:return}},x=async e=>{const n=window.HidePayFE.customizations,r=window.HidePayFE.shop,o={...await(async e=>{const t=await fetch(`https://${e}/cart.json`);return await t.json()})(r),tagsInCart:window.HidePayFE.tagsInCart,collectionsInCart:window.HidePayFE.collectionsInCart,customerCountry:window.HidePayFE.customerCountry,market:`gid://shopify/Market/${window.HidePayFE.market}`};let a=!0;let i=["paypal","google","apple","shoppay","amazon"],s=0;Object.keys(n).forEach((r=>{const u=JSON.parse(n[r]);("true"==u.enabled||1==u.enabled)&&u.d>0?(console.log("🐞 [DEBUG] Current template",e),console.log("🐞 [DEBUG] Cart",o),console.log("🐞 [DEBUG] Rule",u.jsonRule),console.log("🐞 [DEBUG] Hide on pages map",u.h),console.log("🐞 [DEBUG] Is condition verified?",t().apply(u.jsonRule,o))):"true"!=u.enabled&&1!=u.enabled||!t().apply(u.jsonRule,o)||(a=!1,u.h.forEach((t=>{const n=t.pages?.find((t=>e.startsWith(t)));n?(O(!0),F(t.name,n,!1,t.pages?.includes("drawer")),s+=1):F(t.name,n,!0,t.pages?.includes("drawer")),i=i.filter((e=>e!==t.name))})))})),i.forEach((t=>{F(t,e,!0,!0)})),i.length>0&&O(!1),a&&(O(!1),Object.keys(n).forEach((t=>{JSON.parse(n[t]).h.forEach((t=>{F(t.name,e,!0)}))})))};function j(){if("true"==window.HidePayFE.frontendModule.hasPlan){Object.keys(window.HidePayFE.customizations).map((e=>1==JSON.parse(window.HidePayFE.customizations[e]).enabled||"true"==JSON.parse(window.HidePayFE.customizations[e]).enabled)).includes(!0)&&Object.keys(window.HidePayFE.customizations).map((e=>0==JSON.parse(window.HidePayFE.customizations[e]).d)).includes(!0)&&(()=>{const e=document.createElement("style");e.id="paypal-customization",e.innerHTML=`\n ${""!==window.HidePayFE.drawerId&&`#${window.HidePayFE.drawerId} shopify-paypal-button`},\n shopify-paypal-button {\n display: none!important;\n }\n `,document.body.appendChild(e);const t=document.createElement("style");t.id="google-customization",t.innerHTML=`\n ${""!==window.HidePayFE.drawerId&&`#${window.HidePayFE.drawerId} shopify-google-pay-button`},\n shopify-google-pay-button {\n display: none!important;\n }\n `,document.body.appendChild(t);const n=document.createElement("style");n.id="apple-customization",n.innerHTML=`\n ${""!==window.HidePayFE.drawerId&&`#${window.HidePayFE.drawerId} shopify-apple-pay-button`},\n shopify-apple-pay-button {\n display: none!important;\n }\n `,document.body.appendChild(n);const r=document.createElement("style");r.id="shoppay-customization",r.innerHTML=`\n ${""!==window.HidePayFE.drawerId&&`#${window.HidePayFE.drawerId} shop-pay-wallet-button`},\n shop-pay-wallet-button {\n display: none!important;\n }\n `,document.body.appendChild(r);const o=document.createElement("style");o.id="amazon-customization",o.innerHTML=`\n ${""!==window.HidePayFE.drawerId&&`#${window.HidePayFE.drawerId} shopify-amazon-pay-button`},\n shopify-amazon-pay-button {\n display: none!important;\n }\n `,document.body.appendChild(r)})();const e=window.HidePayFE.template;x(e),A.after((async function(t,n){(t.url.match(/cart\/add/)||t.url.match(/cart\/change/))&&200===n.status&&x(e)}))}}!function e(){if(window.HidePayFE&&window.HidePayFE.frontendModule)j();else{const t=new MutationObserver((function(e){e.forEach((function(e){"attributes"===e.type&&"data-frontend-module"===e.attributeName&&window.HidePayFE&&window.HidePayFE.frontendModule&&(t.disconnect(),j())}))}));t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-frontend-module"],subtree:!0,childList:!1}),setInterval(e,10)}}()})()})();